package com.tuju.currency.view.home

import android.os.Bundle
import android.view.View
import com.tuju.currency.R
import com.tuju.currency.base.BaseFragment
import com.tuju.currency.utils.PerfectClickListener

class HomeFragment : BaseFragment() {

    private var mIsPrepared: Boolean = false
    private val mIsFirst = true

    override fun setContent(): Int {
        return R.layout.fragment_home
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        initView()
        mIsPrepared = true
        showContentView()
        loadData()
    }

    private fun initView() {
    }

    var clickListener: PerfectClickListener = object : PerfectClickListener() {
        override fun onNoDoubleClick(v: View) {
            when (v.id) {
            }
        }
    }

    override fun loadData() {
        if (!mIsPrepared || isHidden || !mIsFirst) {
            return
        }
        // loaddata...
    }

    companion object {
        fun newInstance(url: String): HomeFragment {
            val bundle = Bundle()
            bundle.putString("url", url)
            val fragment = HomeFragment()
            fragment.arguments = bundle
            return fragment
        }
    }

}